/**************************************************************************
	DataLogger.h

	The data logger is used as a singleton to log various types of
	information including general info, warnings, and errors.
***************************************************************************/
#pragma once

#include <stdio.h>
#include <Windows.h>

// Enums would be cleaner
//#define MESSAGE_TYPE_INFO	1
//#define MESSAGE_TYPE_WARING	2
//#define MESSAGE_TYPE_ERROR	3

class DataLogger
{
private:
	FILE * pFile;
	static DataLogger *dlLogger;
	char m_chLevel;
	bool m_bClearLog;

public:
	enum eMessageType
	{
		MESSAGE_TYPE_INFO = 1,
		MESSAGE_TYPE_WARING = 2,
		MESSAGE_TYPE_ERROR = 3
	};
	DataLogger(bool bClearLog = false);
	void init(bool bClearLog = false);
	void setLevel(char chLevel);
	static DataLogger * getInstance(bool bClearLog = false)
	{
		if(!dlLogger)
		{
			dlLogger = new DataLogger(bClearLog);
		}

		return dlLogger;
	}
	int addEntry( char *logdata, eMessageType eMsgType = MESSAGE_TYPE_INFO );
	~DataLogger( );
};